Skip to content

quic: Implement callback for http/3 settings/application options#63558

Open
martenrichter wants to merge 6 commits into
nodejs:mainfrom
martenrichter:http3settings
Open

quic: Implement callback for http/3 settings/application options#63558
martenrichter wants to merge 6 commits into
nodejs:mainfrom
martenrichter:http3settings

Conversation

@martenrichter
Copy link
Copy Markdown
Contributor

Implements a callback that is invoked once http/3 settings are received.
Background, http/3 settings usually arrive a bit later than connection establishment, and e.g. for
webtransport these settings are used to indicate support. So e.g. the examples for quiche from google, wait for the settings to arrive. (This is different to http/2).
The implemented callback mechanism allows to wait for the settings to arrive until connection attempts are made.
As settings are stored in the generic applications option object, the callback's name refers to the application rather than the settings.
Whether this is a good choice is debatable.

Fixes: #63553

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/quic

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels May 25, 2026
@martenrichter martenrichter force-pushed the http3settings branch 3 times, most recently from d6acf53 to eb500d1 Compare May 25, 2026 13:14
Implements a callback that is invoked once http/3
settings are received.
Background, http/3 settings usually arrive a bit
later than connection establishment, and e.g. for
webtransport these settings are used to indicate
support. So e.g. the examples for quiche from
 google, wait for the settings to arrive.
 (This is different to http/2).
The implemented callback mechanism allows to wait
for the settings to arrive until connection
attempts are made. As settings are stored in the
generic applications option object, the callback's
 name refers to the application rather than the
 settings. Whether this is a good choice is
 debatable.

Fixes: nodejs#63553
Signed-off-by: Marten Richter <marten.richter@freenet.de>
Comment thread src/quic/session.cc
Comment thread doc/api/quic.md
Comment thread src/quic/session.cc Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.34%. Comparing base (8d3245e) to head (9c5942b).
⚠️ Report is 40 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #63558      +/-   ##
==========================================
+ Coverage   90.14%   90.34%   +0.19%     
==========================================
  Files         718      730      +12     
  Lines      227984   234547    +6563     
  Branches    42835    43909    +1074     
==========================================
+ Hits       205522   211906    +6384     
- Misses      14235    14383     +148     
- Partials     8227     8258      +31     
Files with missing lines Coverage Δ
lib/internal/quic/diagnostics.js 100.00% <100.00%> (ø)
lib/internal/quic/quic.js 100.00% <100.00%> (ø)
lib/internal/quic/state.js 100.00% <100.00%> (ø)
lib/internal/quic/symbols.js 100.00% <100.00%> (ø)

... and 117 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@bjohansebas bjohansebas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGMT!

@martenrichter
Copy link
Copy Markdown
Contributor Author

OK, I am ready, so can someone from you push it?

@bjohansebas bjohansebas added request-ci Add this label to start a Jenkins CI on a PR. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. quic Issues and PRs related to the QUIC implementation / HTTP/3. labels May 25, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@jasnell
Copy link
Copy Markdown
Member

jasnell commented May 25, 2026

@nodejs/quic

@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 25, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Member

@pimterry pimterry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @martenrichter! This'll definitely be useful.

I'd prefer to change the name, I could be persuaded there if others disagree though.

The other comments are a couple of clear little bugs we should definitely fix.

Comment thread doc/api/quic.md
The endpoint that created this session. Returns `null` if the session
has been destroyed. Read only.

### `session.onapplication`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming here is confusing, as you mentioned in the description, since it doesn't emit an application as such. This isn't a generic QUIC thing at all (transport parameters are a separate thing with a different flow) and right now this won't work for anything except HTTP/3. While some other protocols have equivalents it's not clear how closely they would all map to the model, and they definitely all have different names & structures anyway.

For HTTP/3, the RFC calls those 'settings', we use localSettings/remoteSettings in our existing HTTP/2 API. Since this is basically HTTP only and there's no umbrella term, I'd suggest this say 'settings' somewhere explicitly. Just onsettings would work fine from my pov. The rest of our HTTP-specific stuff (onheaders) doesn't explicitly name HTTP in the API naming so that seems consistent.

Beyond this PR: the HTTP/QUIC ambiguity here in the API ties a bit into my thoughts about the request timeout stuff @jasnell - starting to wonder whether we should separate the QUIC & HTTP/3 APIs more explicitly, to make this kind of thing cleaner. The distinction is very blurred together right now and we do lots of HTTP-shaped things for QUIC. Looks doable to split it a bit, really just an API restructuring rather than internals, but there'd be plenty of details to work out. Not required for this PR at all, just fyi, when I have time next week I'll take a look around it as a more general topic and try to open a rough draft to discuss, I have some ideas that'd be fun to explore 😄.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with the naming is, that it dates back to the choice that the http/3 settings are all inside the quic.ApplicationOptions . So I had to decide to call it onsettings , which would be my preferred choice for http/3 settings, or stick with the generic term applicationoptions (though I shortened it to onapplication as it was already very long).

So I think it is kind of a general decision. I have so far just flipped a coin.

Regarding the HTTP/QUIC ambiguity, I am playing around with how to implement webtransport and ngtcp2, and I think you can even wrap the WT streams to the QuicStream and have a mixture of streams. Even if it is confusing, it works some way.

P.S: I try to cover the minor stuff. As I do it in my free time, and the holiday day today is over it may take until next weekend.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor stuff should be all covered. I am now waiting for consensus on the naming scheme.

Comment thread lib/internal/quic/quic.js Outdated
Comment thread lib/internal/quic/quic.js
Comment thread lib/internal/quic/quic.js Outdated
Copy link
Copy Markdown
Member

@pimterry pimterry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes look good. I'd prefer something with 'settings' in the name, but happy to merge as is & change it later if there's no immediate consensus.

@martenrichter
Copy link
Copy Markdown
Contributor Author

Let's see if someone else has an opinion. (I do not have a one...., of course I am happy with no renaming work yet).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. quic Issues and PRs related to the QUIC implementation / HTTP/3.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

quic: http/3 callback required if settings are received

6 participants